home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Security / FULL - Iolo Drive Scrubber 3.5 / DriveScrubber3.exe / {code_GetDSDir} / dshtml.dll / 1033 / HTML / ACTIONBUTTON.JS next >
Text File  |  2008-02-07  |  7KB  |  173 lines

  1. var __ACTION_BUTTON_LINK = "<a onfocus=this.blur(); id=\"{ID}\" href=\"javascript:{EVENT}\" class=\"{CLASS}\" style=\"{STYLE}\">{TEXT}</a>";
  2. var __ACTION_BUTTON_SUBMIT = "<input id=\"{ID}\" type=\"submit\" onclick=\"{EVENT}\" value=\"{TEXT}\" class=\"{CLASS}\" style=\"{STYLE}\">";
  3. var __ACTION_BUTTON_CHECKBOX = "<div class=\"{CLASS}\" style=\"{STYLE}\"><input id=\"{ID}\" type=\"checkbox\" onclick=\"{EVENT}\"><label for=\"{ID}\">{TEXT}</label></div>";
  4. var __ACTION_BUTTON_IMAGE = "<img id=\"{ID}\" src=\"{IMAGE}\" align=\"absmiddle\" onclick=\"{EVENT}\" class=\"{CLASS}\" style=\"{STYLE}\" onmouseover=\"this.src='{IMAGEHOVER}';\" onmouseout=\"this.src='{IMAGE}';\">";
  5.  
  6. var __ACTION_BUTTON_CUSTOM = "<a class=\"{CLASS} {FLOAT}\" style=\"{WIDTH} \"  ";
  7.  __ACTION_BUTTON_CUSTOM += " onmouseover=\"this.className='button_hover {FLOAT}';\"  ";
  8.  __ACTION_BUTTON_CUSTOM += " onmouseout=\"this.className='{CLASS} {FLOAT}';\"  "; 
  9.  __ACTION_BUTTON_CUSTOM += " onmouseup=\"this.className='button_hover {FLOAT}';\"  ";
  10.  __ACTION_BUTTON_CUSTOM += " onmousedown=\"this.className='button_active {FLOAT}';\"   href=\"javascript:void(0);\"  onfocus=\"this.blur();\" ";
  11.  __ACTION_BUTTON_CUSTOM += " onclick=\"{EVENT}\"><span class=\"bt_left\"><span class=\"label\">{TEXT}</span></span></a>";
  12.  
  13. var __ACTION_BUTTON_CUSTOM_DROPDOWN = "<div class=\"button_dropdown {FLOAT}\"> <a class=\"button_dropdown_left\"    style=\"{WIDTH}\"  ID=\"{ID}\" href=\"javascript:void(0);\" ";
  14. __ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseover=\"this.className='button_dropdown_left_hover';Get('{ID}_2').className='button_dropdown_right_hover';\" ";
  15. __ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseout=\"this.className='button_dropdown_left';Get('{ID}_2').className='button_dropdown_right';\" ";
  16. __ACTION_BUTTON_CUSTOM_DROPDOWN += "onmousedown=\"this.className='button_dropdown_left_active';Get('{ID}_2').className='button_dropdown_right_active';\" ";
  17. __ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseup=\"this.className='button_dropdown_left_hover';Get('{ID}_2').className='button_dropdown_right_hover';\" ";
  18. __ACTION_BUTTON_CUSTOM_DROPDOWN += " onfocus=\"this.blur();\" onclick=\"{EVENT}\" ><span class=\"bt_left\"><span class=\"label\">{TEXT}</span></span></a> ";
  19.  
  20. __ACTION_BUTTON_CUSTOM_DROPDOWN += "<a class=\"button_dropdown_right {FLOAT}\" id=\"{ID}_2\"  style=\"float:left;\"      ";
  21. __ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseover=\"this.className='button_dropdown_right_hover_highlighted';Get('{ID}').className='button_dropdown_left_hover';\" ";
  22. __ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseout=\"this.className='button_dropdown_right';Get('{ID}').className='button_dropdown_left';\" ";
  23. __ACTION_BUTTON_CUSTOM_DROPDOWN += "onmousedown=\"this.className='button_dropdown_right_active';\"  ";
  24. __ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseup=\"this.className='button_dropdown_right_hover_highlighted';Get('{ID}').className='button_dropdown_left_hover';\" ";
  25. __ACTION_BUTTON_CUSTOM_DROPDOWN += "href=\"javascript:void(0);\" onfocus=\"this.blur();\"  onclick=\"{EVENT2}\" ></a> </div>";
  26.  
  27. var ACTION_BUTTON_LINK = "1";
  28. var ACTION_BUTTON_SUBMIT = "2";
  29. var ACTION_BUTTON_CHECKBOX = "3";
  30. var ACTION_BUTTON_IMAGE = "4";
  31. var ACTION_BUTTON_CUSTOM = "5";
  32. var ACTION_BUTTON_CUSTOM_DROPDOWN = "6";
  33.  
  34.  
  35. function ActionButton()
  36. {
  37.   this.ID;
  38.   this.Text = "";
  39.   this.Type = ACTION_BUTTON_LINK;
  40.   this.Event = "";
  41.   this.Event2 = "";
  42.   this.Class = "";
  43.   this.Style = "";
  44.   this.Image = "";
  45.   this.ImageHover = "";
  46.   this.MouseOverEvent = "";
  47.   this.MouseOutEvent = "";
  48.   this.Width = "73";
  49.   this.FloatClass = "floatL"; //floatR , floatL
  50.   
  51.   this.Render = __RenderActionButton;
  52.   this.Enable = __EnableActionButton;
  53.   this.Disable = __DisableActionButton;
  54.   this.HoverOn = __HoverOnActionButton;
  55.   this.HoverOff = __HoverOffActionButton;
  56.   this.SetText = __SetText;
  57.   this.SetImage = __ActionButtonSetImage;
  58.   
  59.   this._Enabled = true;
  60.   this._Rendered = false;
  61. }
  62.  
  63.  
  64. function __RenderActionButton()
  65. {
  66.   var content = "";
  67.   
  68.   if (this.Type == ACTION_BUTTON_LINK)
  69.   {
  70.     content = __ACTION_BUTTON_LINK;
  71.   }
  72.   else if (this.Type == ACTION_BUTTON_SUBMIT)
  73.   {
  74.     content = __ACTION_BUTTON_SUBMIT;
  75.   }
  76.   else if (this.Type == ACTION_BUTTON_CHECKBOX)
  77.   {
  78.     content = __ACTION_BUTTON_CHECKBOX;
  79.   }
  80.   else if (this.Type == ACTION_BUTTON_IMAGE)
  81.   {
  82.     content = __ACTION_BUTTON_IMAGE;
  83.   }
  84.    else if (this.Type == ACTION_BUTTON_CUSTOM)
  85.   {
  86.     content = __ACTION_BUTTON_CUSTOM;
  87.     if( this.Width != "")
  88.       content = content.replace( "{WIDTH}", "width:" + this.Width + "px;");
  89.     else
  90.       content = content.replace( "{WIDTH}", "");
  91.       
  92.     if(this.Class == "")
  93.       this.Class = "button";  
  94.   }
  95.   else if (this.Type == ACTION_BUTTON_CUSTOM_DROPDOWN)
  96.   {
  97.     content = __ACTION_BUTTON_CUSTOM_DROPDOWN;
  98.      if( this.Width != "")
  99.       content = content.replace( "{WIDTH}", "width:" + (this.Width -15)  + "px;");
  100.     else
  101.       content = content.replace( "{WIDTH}", "");
  102.   }
  103.   
  104.   if( this.Float != "")
  105.     content = content.replace( /{FLOAT}/g, this.FloatClass );
  106.   
  107.   if( this.MouseOverEvent != "")
  108.     content = content.replace( "this.src='{IMAGEHOVER}'", this.MouseOverEvent );
  109.   if( this.MouseOutEvent != "")
  110.     content = content.replace( "this.src='{IMAGE}'", this.MouseOutEvent );
  111.    if( this.ImageHover != "" )
  112.     content = content.replace("{IMAGEHOVER}", this.ImageHover);
  113.   else
  114.   {
  115.    content = content.replace( "onmouseover=\"this.src='{IMAGEHOVER}';\"", "");
  116.    content = content.replace( "onmouseout=\"this.src='{IMAGE}';\"", "");
  117.     
  118.   }
  119.   
  120.   
  121.   content = content.replace(/{ID}/g, this.ID);
  122.   content = content.replace("{TEXT}", this.Text);
  123.   content = content.replace("{EVENT}", this.Event);
  124.   content = content.replace("{EVENT2}", this.Event2);
  125.   content = content.replace(/{CLASS}/g, this.Class);
  126.   content = content.replace("{STYLE}", this.Style);
  127.   content = content.replace("{IMAGE}", this.Image);
  128.   content = content.replace("{IMAGE}", this.Image);
  129.   
  130.   content = content.replace("{IMAGEHOVER}", this.ImageHover);
  131.   
  132.   
  133.   this._Rendered = true;
  134.   
  135.   return content;
  136. }
  137.  
  138. function __EnableActionButton()
  139. {
  140.   var element = Get(this.ID);
  141.   element.disabled = false;
  142.   this._Enabled = true;
  143. }
  144.  
  145. function __DisableActionButton()
  146. {
  147.   var element = Get(this.ID);
  148.   element.disabled = true;
  149.   this._Enabled = false;
  150. }
  151.  
  152. function __HoverOnActionButton()
  153. {
  154.   var img = Get(this.ID);
  155.   img.src = this.ImageHover;
  156. }
  157.  
  158. function __HoverOffActionButton()
  159. {
  160.   var img = Get(this.ID);
  161.   img.src = this.Image;
  162. }
  163.  
  164. function __SetText( text )
  165. {
  166.   Get( this.ID ).innerHTML = text;
  167. }
  168.  
  169. function __ActionButtonSetImage( value )
  170. {
  171.     var img = Get( this.ID);
  172.   img.src = value;
  173. }